<template>
    <div>
        <van-grid column-num="5">
            <van-grid-item v-for="(icon, index) in channel" :key="index" :icon="icon.icon_url"
                           @click="goChannel(icon.id)"
                           :text="icon.name"/>
        </van-grid>
    </div>
</template>

<script>
import {GetHomeData} from "@/api/home";

export default {
    name: "Grid",
    data() {
        return {
            channel: "",
        }
    },
    beforeCreate() {
        GetHomeData().then(res => {
            this.channel = res.data.channel;
        });
    },
    methods: {
        goChannel(id) {
            console.log(id);
            this.$router.push(`/channel?id=${id}`)
        },
    }
}
</script>

<style scoped>

</style>
